﻿using System;
using System.Collections.Generic;
using System.Web.Services;
using QuanLyHopDong.Biz;

namespace QuanLyHopDong.Web.DanhMuc.LoaiCap
{
    public partial class Default : System.Web.UI.Page
    {
        private static LoaiCapBiz _loaiCapBiz;
        private static LoaiCapBiz LoaiCapManager {
            get { return _loaiCapBiz ?? (_loaiCapBiz = new LoaiCapBiz()); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        [WebMethod(EnableSession = true)]
        public static object SearchLoaiCap(string term)
        {
            var results = LoaiCapManager.SearchLoaiCap(term);

            var keywords = new List<object>();

            foreach (var keyword in results)
            {
                keywords.Add(new { id = keyword.Id, value = keyword.Name });
            }

            return keywords;
        }
    }
}